﻿_quality = "LOW";
Stage.scaleMode = "noScale";
this.stop();

import com.audiopackage.*;
import com.gamepackage.events.*;
import com.gamepackage.comp.*;
import com.gamepackage.tilemap.*;
import com.gamepackage.tilemap.layer.*;
import com.gamepackage.util.*;



//-- FAST DEBUGGING --//
FPS.toTextField( fps_field );

//-- INCLUDE TILEMAP DATA --//
#include "tilemap_front.as"
#include "tilemap_bg.as"

//-- MULTILAYER SETUP --//
var layer_1: ARMLayer 	= new ARMLayer( screen, 1 ,tilemap_bg, 20, 15, 16, 'donuts_bg' );
var layer_2: ARMLayer 	= new ARMLayer( screen, 2 ,tilemap_front, 20, 15, 16, 'donuts_front' );

var world: Multilayer 	= new Multilayer( 20 * 16, 15 * 16 );

world.addLayer( layer_1 );
world.addLayer( layer_2 );

world.setReferenceLayer( layer_2 );

//-- INCLUDE COLLISION MAP --//
#include "worldByteArray.as"

//-- CHARACTER SETUP --//
//
var mario: Mario = new Mario( layer_2, 10 , 16 ,worldByteArray, layer_2 );

mario.moveTo( 128 , 23 * 16 );

//-- AUDIO SAMPLES --//
var samples: GSoundGroup = new GSoundGroup( 'common' , this.createEmptyMovieClip( "_" , 99999 ) );

var capture: Capture = new Capture( world );

capture.adopt( mario );

//-- PRELOADING --//
//
var preloader: MovieClip = this.attachMovie( 'preloader' , 'preloader' , 0 , { _x: 16, _y: 112 } );

var loader: LoadQueue = new LoadQueue();

loader.push( layer_1 , 'donuts/background.swf' , { name: 'donuts.layer.background' } );
loader.push( layer_2 , 'donuts/front.swf' , { name: 'donuts.layer.front' } );
loader.push( samples , 'samples/common.swf' , { name: 'common audio samples' } );

loader.addListener( preloader );

preloader.onUnload = function()
{
	layer_1.create();
	layer_2.create();
	
	mario.attach( 'mario', screen , 3 );
	mario.initSound();
	
	capture.run();
}

loader.load();


















